package time;

import java.time.LocalDate;
import java.time.Period;

/**
 * 计算日期差
 */
public class PeriodTest {
    public static void main(String[] args) {
        LocalDate now = LocalDate.now();
        LocalDate date = LocalDate.of(2019, 8, 8);
        Period period = Period.between(date, now);
        System.out.println("period.getYears() = " + period.getYears());
        System.out.println("period.getMonths() = " + period.getMonths());
        System.out.println("period.getDays() = " + period.getDays());
    }
}
